package com.internetCafes.spms.web.sys.controller;

import java.util.HashMap;
import java.util.Map;

import com.internetCafes.spms.core.utils.PageUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.internetCafes.spms.web.sys.model.MailSendLog;
import com.internetCafes.spms.web.sys.service.MailSendLogService;
import com.internetCafes.spms.core.utils.Query;
import com.internetCafes.spms.core.utils.R;

import javax.servlet.http.HttpServletRequest;




/**
 * 邮件日志
 * 
 * @author Sunny
 * @email rekeeper2011@hotmail.com
 * @date 2019-09-18 14:19:36
 */
@RestController
@RequestMapping("/sys/mailSendLog")
public class MailSendLogController {

	@Autowired
	private MailSendLogService mailSendLogService;



	/**
	 * 列表
	 */
	@RequestMapping("/list")
	@RequiresPermissions("sys:mailSendLog:list")
	public R list(@RequestParam Map<String, Object> params, HttpServletRequest request){

        //查询列表数据
        Query query = new Query(params);
        params = new HashMap<>();

		PageUtils dataGrid = mailSendLogService.page(params, query.getPage(), query.getLimit());

        return R.ok().put("page", dataGrid);
	}


	
	/**
	 * 根据ID获取数据
	 */
	@RequestMapping("/info/{id}")
	@RequiresPermissions("sys:mailSendLog:info")
	public R info(@PathVariable("id") Long id){
		MailSendLog mailSendLog = mailSendLogService.queryObject(id);
		return R.ok().put("mailSendLog", mailSendLog);
	}



	/**
	 * 保存
	 */
	@RequestMapping("/save")
	@RequiresPermissions("sys:mailSendLog:save")
	public R save(@RequestBody MailSendLog mailSendLog){
		mailSendLogService.save(mailSendLog);
		return R.ok();
	}



	/**
	 * 修改
	 */
	@RequestMapping("/update")
	@RequiresPermissions("sys:mailSendLog:update")
	public R update(@RequestBody MailSendLog mailSendLog){
		mailSendLogService.update(mailSendLog);
		return R.ok();
	}



	/**
	 * 删除
	 */
	@RequestMapping("/delete")
	@RequiresPermissions("sys:mailSendLog:delete")
	public R delete(@RequestBody Long[] ids){
		mailSendLogService.deleteBatch(ids);
		return R.ok();
	}
	
}
